package com.example.doer.reading.AppActivities;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

import com.example.doer.reading.R;

/**
 * Created by 严旭江 on 2017/7/21.
 */

public class AskQuestionTwoActivity extends AppCompatActivity implements View.OnClickListener {
    /**
     * questionDesc 问题描述 全局静态变量 用于获取
     */
    public static String questionDesc;
    EditText questionDesc_tv;
    Button btnReturn;
    Button btnNext;
    Spinner spinner;//下拉选项框  选取话题
    public static String chooseTheme;
    @Override
    public void onCreate(Bundle savedInstancetype){
        super.onCreate(savedInstancetype);
        setContentView(R.layout.activity_ask_question_2);
        questionDesc_tv = (EditText)findViewById(R.id.questionDesc);
        btnReturn = (Button)findViewById(R.id.askQuestion_2_btnReturn);
        btnNext = (Button)findViewById(R.id.askQuestion_2_btNext);
        btnReturn.setOnClickListener(this);
        btnNext.setOnClickListener(this);
        spinner = (Spinner)findViewById(R.id.question_spinner);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.askQuestion_2_btnReturn: {//返回按钮
                AskQuestionTwoActivity.this.setResult(2001);
                AskQuestionTwoActivity.this.finish();
                break;
            }
            case R.id.askQuestion_2_btNext:{//提交
                chooseTheme = (String)spinner.getSelectedItem();
                questionDesc = questionDesc_tv.getText().toString();
                AskQuestionTwoActivity.this.setResult(2002);
                AskQuestionTwoActivity.this.finish();
                break;
            }
        }
    }
}//end class
